<!--
 Copyright 2025 Google LLC

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<mat-progress-bar *ngIf="showLoading" mode="indeterminate"></mat-progress-bar>
<nav class="navbar navbar-expand-lg navbar-light bg-light top-nav fixed-top">
    <div class="parent-container">
        <div class="left-heading" [matTooltip]="'Home'" [routerLink]="'/'">
            <span class="logo-text gradient-text">{{headerTitle}}</span>
        </div>
        <app-chat-input (emitSearch)="this.searchTerm($event)" *ngIf="this.isSearchRoute()"></app-chat-input>
        <div class="right-menu-items">
            <div *ngIf="authService.isUserLoggedIn()" class="profile-container" [matMenuTriggerFor]="userAccountMenu">
                <div class="circle" *ngIf="_UserService.getUserDetails().photoURL && requiredLogin === 'True'"><img referrerpolicy="no-referrer"
                        [src]="_UserService.getUserDetails().photoURL" class="user-icon" /> </div>
                <div class="circle bypassLoginLogo" *ngIf="requiredLogin !== 'True'"><mat-icon>person</mat-icon></div>
            </div>
        </div>
    </div>
    <mat-menu #userAccountMenu class="profile-menu" [overlapTrigger]="false" yPosition="below">
      <div class="card-inside-right">
        <div class="name">
          <span class="sub-title">
            {{ requiredLogin === 'True' ? _UserService.getUserDetails().email : 'Guest'}}
          </span>
          <div *ngIf="requiredLogin === 'True' && _UserService.getUserDetails().photoURL ">
            <img [src]="_UserService.getUserDetails().photoURL" class="user-icon container-circle" />
          </div>
          <div *ngIf="requiredLogin !== 'True'" class="user-icon container-circle bypassMenuContainer">
            <mat-icon class="bypassMenuLogo">person</mat-icon>
          </div>
        </div>
        <div class="action-item-container">
          <br>
          <div class="logout" (click)="goToManageConfig()">
            <div class="logout-container">
              <span class="material-symbols-rounded logo">settings</span>
              <div class="text">
                <span class="sub-title">Manage AgentBuilder Config</span>
              </div>
            </div>
          </div>
            <div class="logout logout-button" (click)="logout()" *ngIf="requiredLogin === 'True'">
              <div class="logout-container">
                <span class="material-symbols-rounded logo logout-button-text">exit_to_app</span>
                <div class="text">
                  <span class="sub-title logout-button-text">Logout</span>
                </div>
              </div>
            </div>
          </div>
        </div>
    </mat-menu>
</nav>
